package com.ruoyi.accountant.service.impl;

import com.ruoyi.accountant.dao.SettingDao;
import com.ruoyi.accountant.domain.Setting;
import com.ruoyi.accountant.mapper.SettingMapper;
import com.ruoyi.accountant.service.SettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;

@Service
@Transactional
public class SettingServiceImpl implements SettingService {

    //@Autowired
//    private SettingDao settingDao;

    @Autowired
    private SettingMapper settingMapper;

    @Override
    public void saveOrUpdate(Setting setting) {
        setting.setModifytime(new Timestamp(System.currentTimeMillis()));
        settingMapper.updateByPrimaryKeySelective(setting);
    }

    @Override
    public Setting findById(Long appSettingId) {
        return settingMapper.selectByPrimaryKey(appSettingId);
    }
}
